package com.indexingsystem.system.service.impl;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.github.pagehelper.PageHelper;
import com.indexingsystem.boss.admin.mapper.SystemRulesMapper;
import com.indexingsystem.boss.common.PagedResult;
import com.indexingsystem.boss.entity.SystemRules;
import com.indexingsystem.boss.utils.BeanUtils;
import com.indexingsystem.system.service.ISystemRulesService;

@Service
public class SystemRulesServiceImpl implements ISystemRulesService{

	@Resource
	private SystemRulesMapper systemRulesMapper;
	
	@Override
	public int deleteByPrimaryKey(String ruleId) {
		return systemRulesMapper.deleteByPrimaryKey(ruleId);
	}

	@Override
	public int insertSelective(SystemRules record) {
		return systemRulesMapper.insertSelective(record);
	}

	@Override
	public SystemRules selectByPrimaryKey(String ruleId) {
		return systemRulesMapper.selectByPrimaryKey(ruleId);
	}

	@Override
	public int updateByPrimaryKeySelective(SystemRules record) {
		return systemRulesMapper.updateByPrimaryKeySelective(record);
	}

	@Override
	public PagedResult<SystemRules> selectSystemRulesList(Integer pageNo, Integer pageSize) {
		pageNo = pageNo == null?1:pageNo;
		pageSize = pageSize == null?10:pageSize;
		//startPage是告诉拦截器说我要开始分页了。分页参数是这两个。
		PageHelper.startPage(pageNo,pageSize);  
		return BeanUtils.toPagedResult(systemRulesMapper.selectSystemRulesList());
	}
}